﻿using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using LeanBoard.Models;

namespace LeanBoard
{
    public class InMemoryDataProvider : IDataProvider
    {
        public ItemsCollection GetItems(string team, string release, string filterAll)
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            MemoryStream serialized = new MemoryStream(Encoding.Default.GetBytes(Resources.boardData));
            ItemsCollection itemsCollection = binaryFormatter.Deserialize(serialized) as ItemsCollection;
            serialized.Close();
            return itemsCollection;
        }

        public DominoActionResult MoveItem(Item item)
        {
            return new DominoActionResult() { Status = "success", Message = "ok" };
        }

        public DominoActionResult Assign(string itemUnid, string name, string leanStatus, string type)
        {
            return new DominoActionResult() { Status = "success", Message = "ok" };
        }
    }
}